package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.AreaVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FactoryMapper;
import com.ruoyi.system.domain.Factory;
import com.ruoyi.system.service.IFactoryService;

/**
 * 厂房信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-09-21
 */
@Service
public class FactoryServiceImpl implements IFactoryService 
{
    @Autowired
    private FactoryMapper factoryMapper;

    /**
     * 查询厂房信息
     * 
     * @param id 厂房信息主键
     * @return 厂房信息
     */
    @Override
    public Factory selectFactoryById(Long id)
    {
        return factoryMapper.selectFactoryById(id);
    }

    /**
     * 查询厂房信息列表
     * 
     * @param factory 厂房信息
     * @return 厂房信息
     */
    @Override
    public List<Factory> selectFactoryList(Factory factory)
    {
        return factoryMapper.selectFactoryList(factory);
    }

    /**
     * 新增厂房信息
     * 
     * @param factory 厂房信息
     * @return 结果
     */
    @Override
    public int insertFactory(Factory factory)
    {
        factory.setCreateTime(DateUtils.getNowDate());
        return factoryMapper.insertFactory(factory);
    }

    /**
     * 修改厂房信息
     * 
     * @param factory 厂房信息
     * @return 结果
     */
    @Override
    public int updateFactory(Factory factory)
    {
        factory.setUpdateTime(DateUtils.getNowDate());
        return factoryMapper.updateFactory(factory);
    }

    /**
     * 批量删除厂房信息
     * 
     * @param ids 需要删除的厂房信息主键
     * @return 结果
     */
    @Override
    public int deleteFactoryByIds(Long[] ids)
    {
        return factoryMapper.deleteFactoryByIds(ids);
    }

    /**
     * 删除厂房信息信息
     * 
     * @param id 厂房信息主键
     * @return 结果
     */
    @Override
    public int deleteFactoryById(Long id)
    {
        return factoryMapper.deleteFactoryById(id);
    }

    @Override
    public List<AreaVo> getAreaByGroup() {
        return factoryMapper.getAreaByGroup();
    }

    @Override
    public List<AreaVo> getNumByGroup() {
        return factoryMapper.getNumByGroup();
    }
}
